<script src="../../common/data.js"></script>
<template>
  <div class="search" ref="contractsForm">
    <a-descriptions bordered title="基本信息" :column="4">
      <a-descriptions-item label="合同号">{{info.contractNo}}</a-descriptions-item>
      <a-descriptions-item label="合同名称">{{info.contractName}}</a-descriptions-item>
      <a-descriptions-item label="合同类型">{{info.contractType | formatContractType}}</a-descriptions-item>
      <a-descriptions-item label="申请人">{{info.applicantName}}</a-descriptions-item>
      <a-descriptions-item label="申请日期">{{info.applicantDate | format2}}</a-descriptions-item>
      <a-descriptions-item label="采购组织">{{info.purchasingOrgName}}</a-descriptions-item>
      <a-descriptions-item label="公司">{{info.companyName}}</a-descriptions-item>
      <a-descriptions-item label="采购组">{{info.purchasingOrgName}}</a-descriptions-item>
      <a-descriptions-item label="项目编码">{{info.projectName}}</a-descriptions-item>
    </a-descriptions>
    <br/>
    <a-descriptions bordered title="供应商信息" :column="4">
      <a-descriptions-item label="供应商编码">{{info.vendorErpCode}}</a-descriptions-item>
      <a-descriptions-item label="供应商名称">{{info.vendorName}}</a-descriptions-item>
      <a-descriptions-item label="供应商类型">{{info.vendorType}}</a-descriptions-item>
      <a-descriptions-item label="联系人">{{info.contactsName}}</a-descriptions-item>
      <a-descriptions-item label="联系电话">{{info.contactsNumber}}</a-descriptions-item>
      <a-descriptions-item label="供应商地址">{{info.vendorAddress}}</a-descriptions-item>
      <a-descriptions-item label="货币">{{info.currencyName}}</a-descriptions-item>
      <a-descriptions-item label="税率">{{info.taxrateValue}}</a-descriptions-item>
      <a-descriptions-item label="交货地址">{{info.deliveryAddress}}</a-descriptions-item>
    </a-descriptions>
    <br/>
    <a-descriptions bordered title="付款信息" :column="2">
      <a-descriptions-item label="付款条件">{{info.paymentTermScode}}</a-descriptions-item>
      <a-descriptions-item label="运费，包装费及其他杂费">{{info.freightAmount}}</a-descriptions-item>
    </a-descriptions>
    <br/>
    <a-descriptions bordered title="其他信息" :column="4">
      <a-descriptions-item label="项目材料员">{{info.projectMaterialStaff}}</a-descriptions-item>
      <a-descriptions-item label="材料员邮箱">{{info.materialStaffEmail}}</a-descriptions-item>
      <a-descriptions-item label="材料员联系电话">{{info.materialStaffPhone}}</a-descriptions-item>
      <a-descriptions-item label="指定收货人">{{info.designatedConsignee}}</a-descriptions-item>
      <a-descriptions-item label="收货人邮箱">{{info.designatedConSigneeEmail}}</a-descriptions-item>
      <a-descriptions-item label="收货人联系电话">{{info.designatedConSigneePhone}}</a-descriptions-item>
    </a-descriptions>
    <br/>
    <a-descriptions bordered title="预算相关信息" :column="4">
      <a-descriptions-item label="质保期（月）">{{info.qualityGuaranteePeriod}}</a-descriptions-item>
      <a-descriptions-item label="预算总金额">{{info.budgetAmount}}</a-descriptions-item>
      <a-descriptions-item label="承诺占用金额">{{info.occupancyAmount}}</a-descriptions-item>
      <a-descriptions-item label="实际成本金额">{{info.actualcostAmount}}</a-descriptions-item>
      <a-descriptions-item label="预算占用比列%">0</a-descriptions-item>
      <a-descriptions-item label="合同未税金额">{{info.contractNoTaxAmount}}</a-descriptions-item>
      <a-descriptions-item label="合同金额">{{info.contactsDecimal}}</a-descriptions-item>
      <a-descriptions-item label="累计变更未税金额">{{info.changenotaxAmount}}</a-descriptions-item>
      <a-descriptions-item label="累计变更金额">{{info.changeAmount}}</a-descriptions-item>
      <a-descriptions-item label="合同未税总金额">{{info.contractAllNoTaxAmount}}</a-descriptions-item>
      <a-descriptions-item label="合同总金额">{{info.contractallAmount}}</a-descriptions-item>
      <a-descriptions-item label="折扣总金额">{{info.discountAmount}}</a-descriptions-item>
      <a-descriptions-item label="专业分类">{{info.materialKindCode}}</a-descriptions-item>
      <a-descriptions-item label="付款方式">{{info.paymentMethod}}</a-descriptions-item>
      <a-descriptions-item label="申请人选择意见及里有（仅对选定供应商）">{{info.opinionSandReasons}}</a-descriptions-item>
      <a-descriptions-item label="签订日期">{{info.signDate | format2}}</a-descriptions-item>
      <a-descriptions-item label="生效日期">{{info.effectiveDate | format2}}</a-descriptions-item>
      <a-descriptions-item label="失效日期">{{info.inValidDate | format2}}</a-descriptions-item>
    </a-descriptions>
    <br/><br/><br/>
  </div>
</template>
<script>
  import api from './js/api'
  import { formatDate2, formatContractType } from '../../common/data'

  export default {
    name: 'contractsForm',
    props: ['contractIdParent'],
    data() {
      return {
        refs: this.$refs,
        api: Object.assign(api, this.api),
        info: {}
      }
    },
    methods: {
      //表单赋值
      setContractInfo(data) {
        this.http.get(this, {
          url: this.api.srmContracts.getSingleInfo,
          params: {
            // processInstanceId: data.id
          },
          success: function(me, data) {
            me.info = data
          }
        })

        // this.$refs.contractInfo.resetFields()
        // this.formItem = this.getFormItem()
        // if (data && data.undefined) {
        //   let params = {
        //     // undefined:data.undefined
        //   }
        //   this.refs['form'].getDetails(params, (data) => {
        //     this.formItem = data
        //     this.loaded = true
        //   })
        //   this.isAdd = false
        // } else {
        //   this.loaded = true
        // }
      }
    },
    created() {
      this.http.get(this, {
        url: this.api.srmContracts.getSingleInfo,
        params: {
          contractId: this.contractIdParent
        },
        success: function(me, data) {
          me.info = data
        }
      })
    },
    filters: {
      format2(time) {
        return formatDate2(time, 'yyyy-MM-dd')
      },
      formatContractType(conType) {
        return formatContractType(conType)
      }
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
